# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libusb
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.0.20
pkgrel=1
pkgdesc="Library that provides generic access to USB devices (mingw-w64)"
arch=('any')
url="http://libusb.info/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('staticlibs' 'strip')
source=("https://downloads.sourceforge.net/${_realname}/${_realname}-${pkgver}.tar.bz2")
sha256sums=('cb057190ba0a961768224e4dc6883104c6f945b2bf2ef90d7da39e7c1834f7ff')

build() {
  #export lt_cv_deplibs_check_method='pass_all'
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static

  make -j1
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make check
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
